$(function(){
	$("#addForm").validate({
		rules: {
			questionContent: 'required',
			'aId[]': 'number'
		},
		messages: {
			questionContent: {
				required: "请输入问题内容"
			},
			'aId[]': {
				number: "请输入答案编号（数字）"
			},
		}
	});
	
	var template = '\
		<div class="form-group">\
			<div class="col-sm-offset-3 col-sm-5 desc">\
				<input type="text" class="form-control" name="aId[]" placeholder="输入答案编号">\
			</div>\
			<div class="col-sm-2">\
				<a class="js_delete_answer" href="javascript:;">删除</a>\
			</div>\
		</div>';
	$('#js_add_answer').click(function(e){
		e.preventDefault();
		$('#js_submit').before($(template));
	});
	
	$(document).on('click', '.js_delete_answer', function(e){
		e.preventDefault();
		$(this).closest('.form-group').remove();
	});
	
});